package net.happy2v.file.server.test.file.impl;

import net.ib.mn.protocol.CommonEnvelope.ResponseCode;
import net.ib.mn.protocol.File.DownloadReq;
import net.ib.mn.protocol.File.DownloadRes;
import net.ib.mn.protocol.File.UploadReq;
import net.ib.mn.protocol.File.UploadRes;
import net.ib.mn.protocol.File.ValidateDownloadReq;
import net.ib.mn.protocol.File.ValidateDownloadRes;
import net.ib.mn.protocol.File.ValidateSliceNoReq;
import net.ib.mn.protocol.File.ValidateSliceNoRes;
import net.ib.mn.protocol.File.ValidateUploadReq;
import net.ib.mn.protocol.File.ValidateUploadRes;
import net.ib.mn.protocol.FileServices.File;

import com.google.protobuf.RpcCallback;
import com.google.protobuf.RpcController;

public class FileImpl extends File {

	@Override
	public void validateUpload(RpcController controller,
			ValidateUploadReq request, RpcCallback<ValidateUploadRes> done) {
		System.out.println("validateUpload : ");
	}

	@Override
	public void upload(RpcController controller, UploadReq request,
			RpcCallback<UploadRes> done) {
		System.out.println("upload : ");
		UploadRes res = UploadRes.newBuilder().setFileKey(request.getFileKey())
				.setResponseCode(ResponseCode.SUCCESS).setSliceNo(0).build();
		done.run(res);
	}

	@Override
	public void validateSliceNo(RpcController controller,
			ValidateSliceNoReq request, RpcCallback<ValidateSliceNoRes> done) {
		System.out.println("validateSliceNo : ");
	}

	@Override
	public void validateDownload(RpcController controller,
			ValidateDownloadReq request, RpcCallback<ValidateDownloadRes> done) {
		System.out.println("validateDownload : ");
	}

	@Override
	public void download(RpcController controller, DownloadReq request,
			RpcCallback<DownloadRes> done) {
		System.out.println("download : ");
	}
}
